<?php
// +----------------------------------------------------------------------
// | Author: 发仔 <i@fazi.me> 
// +----------------------------------------------------------------------

namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Cache;

class Models extends Base
{
	protected $id = 'car_type_id';
	protected $table = 'CarType';
	
	//通用选项
	protected function parseData($data = []) {
		
		$data['car_type_name'] = config('base.types')[$data['type']].config('base.types')[$data['car_type']]."({$data['seats']}座)";
		return $data;
		
	}
	
	protected function options($item = []) {
		
		$types = config('base.types');
		$car_types = config('base.car_types');
		//
		$this->assign('types',TplOptions($types,$item['type']?:$item['m.type']));
		$this->assign('car_types',TplOptions($car_types,$item['car_type']?:$item['m.car_type']));
		
		return $item;
	}
	
}
